home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk4 / patch / request.c < prev    next >
C/C++ Source or Header  |  1995-03-18  |  2KB  |  87 lines

  1. /* put up a simple requester */
  2.  
  3. #include    <exec/types.h>
  4. #include    <intuition/intuitionbase.h>
  5. #ifndef MANX
  6. #include    <proto/exec.h>
  7. #include    <proto/intuition.h>
  8. #endif
  9. #include    <stdio.h>
  10. #include    <string.h>
  11. #ifndef MANX
  12. #include    <stdlib.h>
  13. #endif
  14.  
  15. extern struct Library *OpenLibrary();
  16. extern struct IntuitionBase *IntuitionBase;
  17. extern struct GfxBase *GfxBase;
  18.  
  19. /* AutoRequest data structures */
  20. #define REDP 3
  21. #define BLKP 2
  22. #define WHTP 1
  23. #define BLUP 0
  24.  
  25. static struct IntuiText questionText = {
  26.    REDP,     WHTP,
  27.    JAM2,
  28.    5,            /* LeftEdge */
  29.    5,            /* TopEdge  */
  30.    NULL,        /* Default font */
  31.    NULL,        /* Text (to be filled in) */
  32.    NULL            /* No pointer to next text */
  33. };
  34.  
  35. /** YES TEXT **/
  36. static struct IntuiText yesText = {
  37.    BLUP,  WHTP,
  38.    JAM2,
  39.    7,            /* LeftEdge */
  40.    3,            /* TopEdge  */
  41.    NULL,        /* Default font */
  42.    (UBYTE *) "Yes",    /* Text */
  43.    NULL            /* No pointer to next text */
  44. };
  45.  
  46. /** NO TEXT **/
  47. static struct IntuiText noText = {
  48.    REDP,  WHTP,
  49.    JAM2,
  50.     7,            /* LeftEdge */
  51.     3,            /* TopEdge  */
  52.    NULL,        /* Default font */
  53.    (UBYTE *) "No",    /* Text */
  54.    NULL
  55. };
  56.  
  57. initMachSpecific()
  58. {
  59.     if ((GfxBase = (struct GfxBase *) 
  60.      OpenLibrary("graphics.library", 0)) == 0) {
  61.     fprintf(stderr,"Unable to open graphics.library\n");
  62.     my_exit(20);
  63.     }
  64.     if ((IntuitionBase = (struct IntuitionBase *) 
  65.      OpenLibrary("intuition.library", 0)) == 0) {
  66.     fprintf(stderr,"Unable to open intuition.library\n");
  67.     my_exit(21);
  68.     }
  69. }
  70.  
  71. cleanMachSpecific()
  72. {
  73.     if (IntuitionBase)
  74.         CloseLibrary((struct Library *) IntuitionBase);
  75.     if (GfxBase)
  76.         CloseLibrary((struct Library *) GfxBase);
  77. }
  78.  
  79. simpleRequest(question)
  80. char *question;
  81. {
  82.     questionText.IText = (UBYTE *) question;
  83.     return(AutoRequest(0, &questionText, &yesText, &noText, 0, 0,
  84.                max(strlen(question)*8 + 34, 150), 60));
  85. }
  86.  
  87.